import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default function createAutoImport() {
  return [
    AutoImport({
      imports: [
        'vue',
        'vue-router',
        'pinia'
      ],
      dirs: [//配置本地目录自动引入
        "./src/utils/.",
        "./src/store/modules/.",
        "./src/router/.",
        "./src/components/.",
        "./src/global/.",
      ],
      resolvers: [ElementPlusResolver()],
      dts: "types/auto-import.d.ts", // 生成 `auto-import.d.ts` 全局声明
    }),
    Components({
      dirs: ['./src/components/'],
      resolvers: [
        ElementPlusResolver({importStyle: false})
      ],
      dts: "types/components-auto-import.d.ts", // 生成 `auto-import.d.ts` 全局声明
    }),
  ]
}
